home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
readme.txt
< prev
next >
Wrap
Text File
|
1993-08-08
|
7KB
|
137 lines
Notes on the C++ code for "The C++ Answer Book" by Tony L. Hansen,
Addison-Wesley, 1990, ISBN 0-302-11497-6.
............................. The Layout .............................
Each exercise is a file, e.g. "2.1" to "2.11". There are also files named
"tools", "shape" and "appendixB". Each is a shell archive, which can be
picked apart using sh or a text editor. So to get everything, you would
have to say
send 2.1 from c++/answerbook
send 2.2 from c++/answerbook
send 2.3 from c++/answerbook
...
send 8.8 from c++/answerbook
send 8.9 from c++/answerbook
send appendixB from c++/answerbook
send shape from c++/answerbook
send tools from c++/answerbook
But of course you don't need to get everything at once, just ask for the
particular exercise you're interested in at the moment. The complete list is
2.1 3.10 3.9 4.7 6.1 6.7 8.11
2.10 3.11 4.1 4.8 6.10 6.8 8.12
2.11 3.12 4.10 4.9 6.11 6.9 8.13
2.12 3.13 4.11 5.1 6.12 7.1 8.2
2.13 3.14 4.12 5.10 6.13 7.10 8.3
2.14 3.15 4.13 5.11 6.14 7.2 8.4
2.2 3.16 4.14 5.12 6.15 7.3 8.5
2.3 3.17 4.15 5.2 6.16 7.4 8.6
2.4 3.2 4.16 5.3 6.17 7.5 8.7
2.5 3.3 4.17 5.4 6.18 7.6 8.8
2.6 3.4 4.2 5.5 6.2 7.7 8.9
2.7 3.5 4.3 5.6 6.3 7.8 shape
2.8 3.6 4.4 5.7 6.4 7.9 tools
2.9 3.7 4.5 5.8 6.5 8.1 appendixB
3.1 3.8 4.6 5.9 6.6 8.10
............................ The Makefiles ...........................
The makefiles are designed for use on a UNIX machine running an AT&T C++
release. Each makefile has two major targets: the target "all" will create
one or more test programs which use the exercise text, and the target "test"
which will run a series of tests using those test programs. The tests all
consist of running a test program and comparing the output with comparison
files which you will also find present. The makefiles also assume a
directory structure where each chapter is kept in a separate directory named
"ch1" to "ch8", and each exercise is kept in a directory under ch* named
something like "3.2dir".
............................. The Code ..............................
When you look at the C files, you will occassionally note some "scaffolding"
which is not printed in the C++ Answer Book. These consist of several forms
of special C++ comments which were noted during the mechanical processing of
the code into what was printed in the book.
// EXPAND
Lines marked thus are all #include lines. The files may have been
separated to either ease the printing process or the testing process.
Whichever, the expanded files were what was printed in the book.
// DELETE
Lines marked thus are all code put into place to help either the
debugging process or the testing process. All such lines which also
refer to "debug" can be safely removed without affecting the code.
Note that these lines were also not printed in the book.
.................. Notes on the tools directory ......................
Much of the code uses a header file named <debug.h> for debugging purposes.
This header file may be found in "tools", along with <error.h> and error.c.
<debug.h> introduces a single static variable "debug" which is initialized
to the value of the environment variable "DEBUG". It is then used in code
such as the following:
if (debug > 3) cerr << "Value of i=" << i << "\n"; // DEBUG
or
if (debug & 512) cerr << "Value of i=" << i << "\n"; // DEBUG
......................... Notes on <stream.h> ........................
All of the code was written using <stream.h>. For those of you with
<iostream.h> available, most of the code runs without change. Note that the
code in chapter 8 which mucks with the internals of <stream.h> really does
discuss the older version of <stream.h> and you may have to make some
serious modifications to get it to work under <iostream.h>. Or if you have
it, just use <Ostream.h>.
......................... Notes on ch7/shape .........................
When working in Chapter 7, you will have to build the sources in the "shape"
file before any of the exercises. The contents of the shape file should go
into a directory named ch7/shape in order for the other makefiles in chapter
7 to work. This code is a copy of the code in Chapter 7 of "The C++
Programming Language" by Bjarne Stroustrup.
....................... Notes on 1.2 vs. 2.0 Specifics ...............
All of the code was originally written for compilers based on 1987 C++ spec
(that accepted by the 1.2 AT&T release). All of the code in this book does
work on the AT&T 2.0 compiler, although some of code will generate warning
messages about using such anachronisms as calling a member function on a
const object without declare the member function as const.
Some other 2.0-based compilers are more picky about what anachronisms they
will accept. The necessary changes are minor and should not affect the code
itself.
I have found a few compilers which have problems with unsigned shorts, so
consequently the code which uses unsigned shorts extensively, such as class
arbint, may have problems if you run into those machines. Use the tests to
make certain. Also note that different releases of some compilers will have
different bugs.
Another problem with some compilers is that they do not accept the full
language. Some compilers do not accept unary operator+, for example.
Whenever I ran into a compiler bug, I usually just reported the bug to the
appropriate people and got the code to run using a different compiler.
........................... Closing Remarks ..........................
I hope that this code is of use to you. Although the code HAS been
extensively tested, there is always a possibility that I did not test some
particular case, or some code isn't as portable as it should be. If any
problems are found, I certainly wish to hear of them. I will add updates to
the archive as necessary. Also, if there are any problems with this archive
as found on research!netlib, please let me know.
Tony L. Hansen
att!pegasus!hansen, attmail!tony
hansen@pegasus.att.com